package com.laolang.pluto.module.sys.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.laolang.pluto.common.persist.entity.BaseEntity;
import com.laolang.pluto.common.web.jackson.LocalDateTimeDeserialize;
import com.laolang.pluto.common.web.jackson.LocalDateTimeSerialize;
import java.time.LocalDateTime;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
 * @author laolang
 * @date 2021-08-06 23:48
 */
@NoArgsConstructor
@TableName("sys_user")
@EqualsAndHashCode(callSuper = true)
@Data
public class SysUser extends BaseEntity {


    /**
     * 租户id
     */
    private Long tenantId;

    /**
     * 登录名
     */
    private String username;

    /**
     * 昵称
     */
    private String nickname;

    /**
     * 邮箱
     */
    private String email;

    /**
     * 手机号
     */
    private String phone;

    /**
     * <p>性别</p>
     * <ul>
     *     <li>1: 男</li>
     *     <li>2: 女</li>
     *     <li>3: 未知</li>
     * </ul>
     */
    private Integer gender;

    /**
     * 头像地址
     */
    private String avatar;

    /**
     * 密码
     */
    private String password;

    /**
     * 随机盐
     */
    private String salt;

    /**
     * <p>状态</p>
     * <ul>
     *     <li>0: 正常</li>
     *     <li>99: 冻结</li>
     * </ul>
     */
    private Integer status;

    /**
     * <p>类型</p>
     * <ul>
     *     <li>1: 租户主账号</li>
     *     <li>2: 子账号</li>
     *     <li>3: 个人主账号</li>
     * </ul>
     */
    private Integer type;

    /**
     * 最后登录ip
     */
    private String loginIp;

    /**
     * 最后登录时间
     */
    @JsonDeserialize(using = LocalDateTimeDeserialize.class)
    @JsonSerialize(using = LocalDateTimeSerialize.class)
    private LocalDateTime loginTime;

}
